package com.zrf.testchatgpt.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zrf.testchatgpt.entity.Role;
import com.zrf.testchatgpt.util.Result;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;

import javax.swing.plaf.PanelUI;
import java.util.ArrayList;
import java.util.List;

public interface RoleMapper extends BaseMapper<Role> {

    public List<Role> queryByUserId(Integer userid);
    public int updateRoleById(@Param("userId") String userId,@Param("list") List<Integer> list);
    public int deleteRoleById(@Param("userId") String userId,@Param("list") List<Integer> list);

    public int insertRole(@Param("roleId") String roleId, @Param("list") List<Integer> list);
    public int deleteRoleP(@Param("roleId") String roleId, @Param("list") List<Integer> list);
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert("insert into role(role_name,`desc`) values(#{role.roleName},#{role.desc})")
    public Integer Myinsert(@Param("role") Role role);
    @Select("select role_id from user_role where user_id=#{id}" )
    public List<Integer> getRoleByUserId(String id);
}
